﻿using DMTroube_ZeKer.Control;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using System.Xml.Linq;
using Model.Msg;

namespace DMTroube_ZeKer.View.ToolView
{
    public partial class PinLunTool : UserControl
    {
        private MainWebView _webView;
        public PinLunTool(MainWebView webView)
        {
            _webView = webView;
            InitializeComponent();
            string url = Path.GetFullPath("Resources/Html/pinglun.html");
            PinLunText.Source = new Uri("file:///" + url);
            _webView.PinLunInfo += _webView_PinLunInfo;
        }

        private void _webView_PinLunInfo(object? arg1, ResultAnalysisInfo arg2)
        {
            string msg = string.Format("<div style=\"font-size: 12px;\">等级:{0} 粉丝灯牌:{1}</div><div style=\"font-size: 12px;\">昵称:{2}</div><span style=\"color: cornflowerblue;\">{3}</span>", arg2.Level, arg2.FanGroup, arg2.UserName, arg2.Content);
            PinLunText.ExecuteScriptAsync("addPinglun(\'" + msg + "\')");
        }
    }
}
